<%@ page import="com.cat.pojo.Student" %>

<%--
  Created by IntelliJ IDEA.
  User: Misterchaos
  Date: 2019/3/23
  Time: 23:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setCharacterEncoding("utf-8");
    Student stu = (Student) request.getAttribute("login");
    String studentId = stu.getStudentId();
    String studentName = stu.getStudentName();
    String phoneNumber = stu.getPhoneNumber();
    String password = stu.getPassword();
    String userType = stu.getUserType();
    String portrait = stu.getPortrait();
    String gender = stu.getGender();
    String major = stu.getMajor();
    String majorClass = stu.getMajorClass();
    String position = stu.getPosition();
    String introduction = stu.getIntroduction();
%>
<html>
<head>
    <title>个人中心</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet"
          href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
    <div class="jumbotron">
        <h1 align="center">我的个人主页</h1>
        <img src="<%=portrait%>" class="img-thumbnail" width="200px"><br/><br/>
        <p><strong>欢迎回来,<%=studentName%>
        </strong></p>
        <a href="StudentServlet?method=index" align="center" methods="post">
            <button type="button" class="btn btn-primary">返回主页</button>
        </a>
    </div>
<%
    if (request.getParameter("update") != null) {
        out.print("<div class=\"jumbotron\" style=\"width:auto\" >\n" +
"    <form action=\"StudentServlet\" method=\"post\" enctype=\"multipart/form-data\">"+
"        <div class=\"color-input-field\" style=\"width: auto\">\n" +
"            <input type=\"text\" class=\"form-control\" name=\"studentId\"  readonly=\"readonly\" value= \""+ studentId +"\" /> <br/>\n" +
"            <input type=\"text\" class=\"form-control\" name=\"studentName\" value=\""+studentName+"\" /><br/>\n" +
"            <input type=\"text\" class=\"form-control\" name=\"phoneNumber\" value=\""+phoneNumber+"\"/><br/>\n" +
"            <input type=\"text\" class=\"form-control\" name=\"password\" value=\"****\"/><br/>\n" +
"            性别:\n" +
"            <input type=\"radio\" name=\"gender\" checked=\"checked\" value=\"男\" />男\n" +
"            <input type=\"radio\" name=\"gender\" value=\"女\" />女<br/><br/>\n" +
"            <input type=\"text\" class=\"form-control\" name=\"major\" value=\""+major+"\"/><br/>\n" +
"            <input type=\"text\" class=\"form-control\" name=\"majorClass\" value=\""+majorClass+"\"/><br/>\n" +
"            方向:\n" +
"            <input type=\"radio\" name=\"position\" value=\"前端\" checked=\"checked\"/>前端\n" +
"            <input type=\"radio\" name=\"position\" value=\"后台\"/>后台<br/><br/>\n" +
"            <input type=\"text\" class=\"form-control\" name=\"introduction\" value=\""+introduction+"\"/><br/>\n" +
"        </div>"+
                        "    <td align=\"left\"><input type=\"submit\" name=\"method\" value=\"修改\">\n" +
                        "    <td align=\"left\"><input type=\"submit\" name=\"method\" value=\"取消\">\n" +
                        "</form></div>");
    } else {
        out.print("<div class=\"table-responsive\" align=\"center\" style=\"padding: 40px\">\n" +
                "<table class=\"table table-striped\"align=\"left\" style=\"padding: 80px\" border=\"1\">\n" +
                "    <caption align=\"left\">" + studentName + "的报名表</caption>\n" +
                " <tr>\n" + " <th align=\"left\">学号</th>\n" +
                " <th align=\"left\">姓名</th>\n" +
                " <th align=\"left\">手机号</th>\n" +
                " <th align=\"left\">密码</th>\n" +
                " <th align=\"left\">用户类型</th>\n" +
                " <th align=\"left\">性别</th>\n" +
                " <th align=\"left\">专业</th>\n" +
                " <th align=\"left\">班级</th>\n" +
                " <th align=\"left\">方向</th>\n" +
                " <th align=\"left\">自我介绍</th>\n" +
                "<th align=\"left\">操作</th>\n" +
                " </tr>\n" +
                " <tr>\n" +
                " <td align=\"left\">" + studentId + "</td>\n" +
                " <td align=\"left\">" + studentName + "</td>\n" +
                " <td align=\"left\">" + phoneNumber + "</td>\n" +
                " <td align=\"left\">" + "****" + "</td>\n" +
                " <td align=\"left\">" + userType + "</td>\n" +
                " <td align=\"left\">" + gender + "</td>\n" +
                " <td align=\"left\">" + major + "</td>\n" +
                " <td align=\"left\">" + majorClass + "</td>\n" +
                " <td align=\"left\">" + position + "</td>\n" +
                " <td align=\"left\">" + introduction + "</td>\n" +
                " <td align=\"left\">" + "<form action=\"StudentServlet?method=update.view&stuId=" + studentId + "\"" + " method=\"post\"><input type=\"submit\"" + "value=\"修改\"></form></td>" +
                " </tr>\n" + "\n" +
                "</table></div>\n");
    }
%>
</body>
</html>
